﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
{-include file="`$__PHY_WEB``$__DIR_ADM`/block/meta.tpl"-}
<title>作品管理 - 后台</title>
<style>
.album { margin-left:8px; }
.album table { border:1px solid silver; margin-bottom:6px; }
</style>
</head>

<body>
<div class="sAll">

{-include file="`$__PHY_WEB``$__DIR_ADM`/block/header.tpl"-}
{-php-}include(__PHY_WEB.__DIR_ADM."/block/menu.php");{-/php-}
{-include file="`$__PHY_WEB``$__DIR_ADM`/block/menu.tpl" uL=$rNav-}

<div class="sL">
	<div class="sW main">
<!-- <main> -->
{- if $sMsg -}{- include file="`$__PHY_WEB``$__DIR_ADM`/block/message.tpl" -}{- /if -}

{- if 'list'==$sAction -}
<div class="sL list">
	<p>列表</p>
	<div><span>按类别查找：</span>
		<span><select onchange="location.href='?{-$rPager.Bse|build_query:"category:_"-}&category='+this.value;">
			<option value="0">&lt; 所有类别 &gt;</option>
{-section name=i loop=$rSlctCtgrys-}
	<option value="{-$rSlctCtgrys[i].id-}"{-if $rSlctCtgrys[i].id==$rP.category-} selected="selected"{-/if-}>{-$rSlctCtgrys[i].BreadCrumb|escape:html-}</option>
{-/section-}
		</select></span>
	</div>
	<table>
		<tr class="capt">
			<td>ID</td>
			<td>类别</td>
			<td>标题</td>
			<td>标题(英)</td>
			<td>库存</td>
			<td>作者</td>
			<td>制作时间</td>
			<td><a href="?action=new">录入</a></td>
		</tr>
{-section name=i loop=$rList-}
		<tr>
			<td>{-$rList[i].id|escape:html-}</td>
			<td>{-html_breadcrumb from=$rList[i].BreadCrumb-}</td>
			<td><span title="{-$rList[i].title|escape:html-}">{-$rList[i].title|td_truncate:20|escape:html-}</span></td>
			<td><span title="{-$rList[i].title_en|escape:html-}">{-$rList[i].title_en|td_truncate:20|escape:html-}</span></td>
			<td>{-$rList[i].stock|escape:html-}</td>
			<td><a href="./user.php?action=edit&id={-$rList[i].owner_id-}">{-$rList[i].owner_nick|escape:html-}</a></td>
			<td>{-$rList[i].time_added-}</td>
			<td><a href="?action=edit&id={-$rList[i].id-}">详细</a></td>
		</tr>
{-/section-}
		<tr class="capt">
			<td>ID</td>
			<td>类别</td>
			<td>标题</td>
			<td>标题(英)</td>
			<td>库存</td>
			<td>作者</td>
			<td>制作时间</td>
			<td><a href="?action=new">录入</a></td>
		</tr>
	</table>
	<div>
		<span>翻页条：</span>
{-html_pager max=$rPager.Max page=$rPager.Num
	link="<a href=\"?`$rPager.Bse`&`$rPager.Req`={X}\">{X}</a>"
	text="{X}"
-}
		<span>每页{-$rPager.Sze-}条</span>
	</div>
</div>
{- elseif 'edit'==$sAction -}
<div class="sL edit">
	<p>修改</p>
	<form method="post" action="?" enctype="multipart/form-data">
	<table>
		<input type="hidden" name="id" value="{-$rOne.id|escape:html-}" />
		<tr>
			<td class="indc">缩略图：</td>
			<td><input type="file" name="thumb" value="" /><br />
				<img src="{-$rOne.thumb|uWork_thumb:$rOne.id:'166x166.jpg'-}" />
				<img src="{-$rOne.thumb|uWork_thumb:$rOne.id:'50x50.jpg'-}" />
			</td>
		</tr>
		<tr>
			<td class="indc">作者：</td>
			<td><a href="./user.php?action=edit&id={-$rOne.owner_id-}">{-$rOne.owner_nick|escape:html-}</a></td>
		</tr>
		<tr>
			<td class="indc">类别：</td>
			<td><select name="category_id">
				<option value="0">&lt; 选择类别 &gt;</option>
{-section name=i loop=$rSlctCtgrys-}
	<option value="{-$rSlctCtgrys[i].id-}"{-if $rOne.category_id==$rSlctCtgrys[i].id-} selected="selected"{-/if-}>{-$rSlctCtgrys[i].BreadCrumb|escape:html-}</option>
{-/section-}
			</select></td>
		</tr>
		<tr>
			<td class="indc">标题：</td>
			<td><input type="text" name="title" value="{-$rOne.title|escape:html-}" class="long" /><br />
				英<input type="text" name="title_en" value="{-$rOne.title_en|escape:html-}" class="long" />
			</td>
		</tr>
		<tr>
			<td class="indc">描述：</td>
			<td><textarea name="description" class="long">{-$rOne.description|escape:html-}</textarea><br />
				英<textarea name="description_en" class="long">{-$rOne.description_en|escape:html-}</textarea>
			</td>
		</tr>
		<tr>
			<td class="indc">标签：</td>
			<td><input type="text" name="tags" value="{-$rOne.tags|escape:html-}" class="long" /></td>
		</tr>
		<tr>
			<td class="indc">年份：</td>
			<td><input type="text" name="year" value="{-$rOne.year|escape:html-}" /></td>
		</tr>
		<tr>
			<td class="indc">重量：</td>
			<td><input type="text" name="weight" value="{-$rOne.weight|escape:html-}" />
				英<input type="text" name="weight_en" value="{-$rOne.weight_en|escape:html-}" />
			</td>
		</tr>
		<tr>
			<td class="indc">┏ 尺寸<br />├ 边框<br />├ 库存<br />┗ 价格</td>
			<td><input type="radio" name="has_size" value="0"{-if 1!=$rOne.has_size-} checked="checked"{-/if-} />单尺寸↓ &nbsp;
				<input type="radio" name="has_size" value="1"{-if 1==$rOne.has_size-} checked="checked"{-/if-} /><a href="?action=size&id={-$rOne.id|escape:html-}">多尺寸&gt;&gt;</a><br />
				<table>
					<tr><td class="indc">尺寸</td><td colspan="3">
						<input type="text" name="size" value="{-$rOne.size|escape:html-}" size="10" />
						英<input type="text" name="size_en" value="{-$rOne.size_en|escape:html-}" size="10" />
					</td></tr>
					<tr><td class="indc">￥：</td>
						<td><input type="text" name="price" value="{-$rOne.price|escape:html-}" size="4" /></td>
						<td class="indc">剩余库存</td>
						<td><input type="text" name="stock" value="{-$rOne.stock|escape:html-}" size="4" /></td>
					</tr>
					<tr>
						<td class="indc">＄：</td>
						<td><input type="text" name="price_en" value="{-$rOne.price_en|escape:html-}" size="4" /></td>
						<td class="indc">限量库存</td>
						<td><input type="text" name="stock_max" value="{-$rOne.stock_max|escape:html-}" size="4" /></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="indc">添加时间</td>
			<td>{-$rOne.time_added|escape:html-}</td>
		</tr>
		<tr>
			<td class="indc">修改时间</td>
			<td>{-$rOne.time_updated|escape:html-}</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				&nbsp; <input type="submit" name="action" value="update" />
				&nbsp; <input type="submit" name="action" value="delete" onclick="return confirm('确定删除？');" />
				&nbsp; <input type="submit" name="action" value="cancel" />
			</td>
		</tr>
	</table>
	</form>
</div>
<div class="sL album">
	<p>图集</p>
{-section name=i loop=$rAlbums-}
	<form method="post" enctype="multipart/form-data"><table>
		<input type="hidden" name="work" value="{-$rOne.id-}" />
		<input type="hidden" name="id" value="{-$rAlbums[i].id-}" />
		<tr>
			<td rowspan="3"><img src="{-$rAlbums[i].thumb|uWorkAlbum_thumb:$rAlbums[i].id:'59x59.jpg'-}" /></td>
			<td>序<select name="rank">
{-section name=j loop=$nAlbumsMaxRank-}
{-if $rAlbums[i].rank==$smarty.section.j.iteration-}
	<option value="{-$smarty.section.j.iteration-}" selected="selected">({-$smarty.section.j.iteration-})</option>
{-else-}
	<option value="{-$smarty.section.j.iteration-}">{-$smarty.section.j.iteration-}</option>
{-/if-}
{-/section-}
				</select>
				<a href="{-$rAlbums[i].thumb|uWorkAlbum_thumb:$rAlbums[i].id:'585x415.jpg'-}" target="_blank">585x415.jpg</a>
			</td>
		</tr>
		<tr><td>汉<input type="text" name="title" value="{-$rAlbums[i].title|escape:html-}" /></td></tr>
		<tr><td>英<input type="text" name="title_en" value="{-$rAlbums[i].title_en|escape:html-}" />
			<a href="?action=delete_album&id={-$rAlbums[i].id-}&work={-$rAlbums[i].work_id-}" onclick="return confirm('确定删除？');">删除</a>
		</tr>
		<tr><td colspan="2">
			<input type="file" name="thumb" />
			<input type="submit" name="action" value="update_album" />
		</td></tr>
	</table></form>
{-sectionelse-}
	<span>无记录</span>
{-/section-}
	<p>添加图集</p>
	<form method="post" enctype="multipart/form-data"><table>
		<input type="hidden" name="work" value="{-$rOne.id-}" />
		<tr><td>说明文字，汉<input type="text" name="title" value="" /></td></tr>
		<tr><td>说明文字，英<input type="text" name="title_en" value="" /></td></tr>
		<tr><td colspan="2">
			<input type="file" name="thumb" />
			<input type="submit" name="action" value="add_album" />
		</td></tr>
	</table></form>
</div>
{- elseif 'size'==$sAction -}
<div class="sL list">
	<p>作品：
		{-$rOne.title|escape:html-}
		({-$rOne.title_en|escape:html-})
		&nbsp; <a href="?action=edit&id={-$rOne.id-}">返回</a></p>
	</table>
	<p>其尺寸、边框、价格和库存：</p>
	<table>
		<tr class="capt">
			<td rowspan="2">序</td>
			<td rowspan="2">尺寸（中文）</td>
			<td rowspan="2">尺寸（英文）</td>
			<td colspan="4">无边框</td>
			<td colspan="4">带边框</td>
			<td rowspan="2">&nbsp;</td>
		</tr>
		<tr class="capt">
			<td>￥</td>
			<td>＄</td>
			<td>库存</td>
			<td>限量数</td>
			<td>￥</td>
			<td>＄</td>
			<td>库存</td>
			<td>限量数</td>
		</tr>
{-section name=i loop=$rList-}
		<form method="post">
		<input type="hidden" name="work_id" value="{-$rOne.id-}" />
		<input type="hidden" name="size_id" value="{-$rList[i].id-}" />
		<input type="hidden" name="k_id" value="{-$rList[i].k_id-}" />
		<tr>
			<td><select onchange="location.href='?action=move_size&id={-$rOne.id-}&size_id={-$rList[i].id-}&rank='+this.value">
				{-section name=j loop=$nRankMax-}
				<option value="{-$smarty.section.j.iteration-}"{-if $rList[i].rank==$smarty.section.j.iteration-} selected="selected"{-/if-}>{-$smarty.section.j.iteration-}</option>
				{-/section-}
			</select></td>
			<td><input type="text" name="title" value="{-$rList[i].title|escape:html-}" size="10"></td>
			<td><input type="text" name="title_en" value="{-$rList[i].title_en|escape:html-}" size="10"></td>
			<td><input type="text" name="n_price" value="{-$rList[i].n_price|escape:html-}" size="2"></td>
			<td><input type="text" name="n_price_en" value="{-$rList[i].n_price_en|escape:html-}" size="2"></td>
			<td><input type="text" name="n_stock" value="{-$rList[i].n_stock|escape:html-}" size="2"></td>
			<td><input type="text" name="n_stock_max" value="{-$rList[i].n_stock_max|escape:html-}" size="2"></td>
			<td><input type="text" name="k_price" value="{-$rList[i].k_price|escape:html-}" size="2"></td>
			<td><input type="text" name="k_price_en" value="{-$rList[i].k_price_en|escape:html-}" size="2"></td>
			<td><input type="text" name="k_stock" value="{-$rList[i].k_stock|escape:html-}" size="2"></td>
			<td><input type="text" name="k_stock_max" value="{-$rList[i].k_stock_max|escape:html-}" size="2"></td>
			<td><input type="submit" name="action" value="update_size">
				<a href="?action=delete_size&id={-$rOne.id-}&size_id={-$rList[i].id-}" onclick="return confirm('确定删除？');">╳</a>
			</td>
		</tr>
		</form>
{-/section-}
		<form method="post">
		<input type="hidden" name="work_id" value="{-$rOne.id-}" />
		<tr>
			<td align="center">＋</td>
			<td><input type="text" name="title" size="10"></td>
			<td><input type="text" name="title_en" size="10"></td>
			<td><input type="text" name="n_price" size="2"></td>
			<td><input type="text" name="n_price_en" size="2"></td>
			<td><input type="text" name="n_stock" size="2"></td>
			<td><input type="text" name="n_stock_max" size="2"></td>
			<td><input type="text" name="k_price" size="2"></td>
			<td><input type="text" name="k_price_en" size="2"></td>
			<td><input type="text" name="k_stock" size="2"></td>
			<td><input type="text" name="k_stock_max" size="2"></td>
			<td align="center"><input type="submit" name="action" value="add_size"></td>
		</tr>
		</form>
	</table>
</div>
{- elseif 'new'==$sAction -}
<div class="sL edit">
	<p>录入</p>
	<form method="post" action="?" enctype="multipart/form-data">
	<table>
		<tr>
			<td class="indc">上传图片：</td>
			<td><input type="file" name="thumb" /></td>
		</tr>
		<tr>
			<td class="indc">作者：</td>
			<td><select name="owner_id">
				<option value="0">&lt; 选择作者 &gt;</option>
{-section name=i loop=$rSlctArtists-}
	<option value="{-$rSlctArtists[i].id-}">{-$rSlctArtists[i].nick|escape:html-} ({-$rSlctArtists[i].email|escape:html-})</option>
{-/section-}
			</select></td>
		</tr>
		<tr>
			<td class="indc">类别：</td>
			<td><select name="category_id">
				<option value="0">&lt; 选择类别 &gt;</option>
{-section name=i loop=$rSlctCtgrys-}
	<option value="{-$rSlctCtgrys[i].id-}">{-$rSlctCtgrys[i].BreadCrumb|escape:html-}</option>
{-/section-}
			</select></td>
		</tr>
		<tr>
			<td class="indc">标题：</td>
			<td><input type="text" name="title" value="{-$rOne.title|escape:html-}" class="long" /><br />
				英<input type="text" name="title_en" value="{-$rOne.title_en|escape:html-}" class="long" />
			</td>
		</tr>
		<tr>
			<td class="indc">库存：</td>
			<td>限量供应数：<input type="text" name="stock_max" value="{-$rOne.stock_max|escape:html-}" size="4" /></td>
		</tr>
		<tr>
			<td class="indc">描述：</td>
			<td><textarea name="description" class="long">{-$rOne.description|escape:html-}</textarea><br />
				英<textarea name="description_en" class="long">{-$rOne.description_en|escape:html-}</textarea>
			</td>
		</tr>
		<tr>
			<td class="indc">标签：</td>
			<td><input type="text" name="tags" value="{-$rOne.tags|escape:html-}" class="long" /></td>
		</tr>
		<tr>
			<td class="indc">年份：</td>
			<td><input type="text" name="year" value="{-$rOne.year|escape:html-}" /></td>
		</tr>
		<tr>
			<td class="indc">尺寸：</td>
			<td><input type="text" name="size" value="{-$rOne.size|escape:html-}" />
				英<input type="text" name="size_en" value="{-$rOne.size_en|escape:html-}" />
			</td>
		</tr>
		<tr>
			<td class="indc">重量：</td>
			<td><input type="text" name="weight" value="{-$rOne.weight|escape:html-}" />
				英<input type="text" name="weight_en" value="{-$rOne.weight_en|escape:html-}" />
			</td>
		</tr>
		<tr>
			<td class="indc">价格：</td>
			<td>￥:<input type="text" name="price" value="{-$rOne.price|escape:html-}" size="6" />
				＄:<input type="text" name="price_en" value="{-$rOne.price_en|escape:html-}" size="6" /></td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<input type="submit" name="action" value="insert" />
				<input type="submit" name="action" value="cancel" />
			</td>
		</tr>
	</table>
	</form>
</div>
{- else -}
sth wrong: no $sAction.
{- /if -}

<!-- </main> -->
	</div>
</div>

{- include file="`$__PHY_WEB``$__DIR_ADM`/block/footer.tpl" -}

</div><!-- end all -->
</body>
</html>
